import axios from 'axios';
import global from '../../assets/js/global'

let agreement = global.agreement;//合约  --- wsg
//获取钱包
export const contractWalletGet = params => { return axios.post(`${agreement}/contractWallet/get`, params).then(res => res) };
//获取合约上架状态和杠杆
export const getContract = params => { return axios.post(`${agreement}/contract/getContract`, params).then(res => res) };
//添加合约委托
export const contractAdd = params => { return axios.post(`${agreement}/contractEntrust/add`, params).then(res => res) };
//当前委托/历史委托
export const contractEntrustList = params => { return axios.post(`${agreement}/contractEntrust/list`, params).then(res => res) };
//持仓列表
export const contractWarehouseList = params => { return axios.post(`${agreement}/contractWarehouse/list`, params).then(res => res) };
//平仓列表
export const contractWarehouseHistory = params => { return axios.post(`${agreement}/contractWarehouse/history`, params).then(res => res) };
//手动平仓
export const contractWarehouseClose = params => { return axios.post(`${agreement}/contractWarehouse/close`, params).then(res => res) };
//撤单
export const contractEntrustUpdate = params => { return axios.post(`${agreement}/contractEntrust/update`, params).then(res => res) };
//修改止盈止损--当前委托
export const currentUpdateTakeprofit = params => { return axios.post(`${agreement}/contractEntrust/updateTakeprofit`, params).then(res => res) };
//修改止盈止损--持有仓位
export const holdContractWarehouseUpdate = params => { return axios.post(`${agreement}/contractWarehouse/update`, params).then(res => res) };
//财务记录类型
export const contractWalletType = params => { return axios.post(`${agreement}/contractWallet/type`, params).then(res => res) };
//获取合约账单
export const contractWalletRecord = params => { return axios.post(`${agreement}/contractWallet/record`, params).then(res => res) };
//划转
export const walletTransfer = params => { return axios.post(`${agreement}/contractWallet/transfer`, params).then(res => res) };





let kline = global.kline;//k线 --- zj
//获取合约列表
export const get24hrDataForAgreement = params => { return axios.get(`${kline}/quotations/get24hrDataForAgreement`, {params:params}).then(res => res) };
//获取盘口
export const getBuySellContractData = params => { return axios.get(`${kline}/quotations/getBuySellContractData`, {params:params}).then(res => res) };
//获取实时成交
export const getDealRecordContract = params => { return axios.get(`${kline}/quotations/getDealRecordContract`, {params:params}).then(res => res) };
//获取币种汇率
export const getExchangeRateByCoinName = params => { return axios.get(`${kline}/quotesExchangeRate/getExchangeRateByCoinName`, {params:params}).then(res => res) };
//币种详情
export const getCoinInfoByName = params => { return axios.get(`${kline}/coinInfo/getCoinInfoByName`, {params:params}).then(res => res) };



let person = global.center;//个人中心  --- zk
//用户余额
export const userWalletList = params => { return axios.get(`${person}/userWallet/list`, {params:params}).then(res => res) };